﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using ZLDC.Common.Estate;

namespace ZLDC.Topo.BLL.Estate
{
                public class EstateOtherNameBLL
    {
                                                public static string EstateOtherNameList(int page, int pagesize, int typeid, string condition)
        {
            DataTable dt = null;
            int total = 0;                       int pageall = 0;         
            using (_Database db = new _Database("estate"))
            {
                dt = ZLDC.DAL.Estate.EstateOtherNameDAL.p_estate_other_name_list_table(page, pagesize, typeid, condition, ref total, db);                
            }

            pageall = _Utility.GetPageAll(pagesize, total);      
            _Json json = new _Json(dt);
            return "{page:{currentpage:'" + page + "',pagesize:'" + pagesize + "',total:'" + total + "',pageall:'" + pageall + "'},record:" + json.ToJson() + "}";
        }

                                                                                public static string EstateOtherNameCheck(int ID, string agreeName, string agreeDapt, int isAgreement, string remark)
        {
            string outmsg = "";

            using (_Database db = new _Database("estate"))
            {
                ZLDC.DAL.Estate.EstateOtherNameDAL.p_estate_other_name_check(ID, agreeName, agreeDapt, isAgreement, remark, out outmsg, db);
            }

            return outmsg;
        }

                                                public static string GetFinalNameByID(int id)
        {
            string text = "";
            DataTable dt = null;

            using (_Database db = new _Database("estate"))
            {
                dt = ZLDC.DAL.Estate.EstateOtherNameDAL.p_estate_other_name_detail_table(id, db);

                if (dt != null && dt.Rows.Count > 0)
                {
                    text = dt.Rows[0]["finalname"].ToString();
                }
            }

            return text;
        }
    }
}
